<?php 
class Citys extends E_Entity 
{
	public static function getProvinces()
	{
		$_DB = E_DBConnectionPool::getDbHandle();
		
		$sql = "select * from provinces";
		$row = $_DB->fetchAll($sql);
		return $row;
	}
	public static function getCitys($pid)
	{
		$_DB = E_DBConnectionPool::getDbHandle();
		
		$sql = "select id,name from citys where pid='$pid'";
		$row = $_DB->fetchAll($sql);
		return $row;
	}
	public static function getAreas($cid)
	{
		$_DB = E_DBConnectionPool::getDbHandle();
		
		$sql = "select id,name from areas where cid='$cid'";
		$row = $_DB->fetchAll($sql);
		return $row;
	}
	public static function getZone($id)
	{
		$_DB = E_DBConnectionPool::getDbHandle();
		
		$sql = "select postcode,zone from areas where id='$id'";
		$row = $_DB->fetch($sql);
		return $row;
	}
	public function getByProvinceId($id)
	{
		$_DB = E_DBConnectionPool::getDbHandle();
		$sql = "select * from provinces where id='$id'";
		$row = $_DB->fetch($sql);
		return $row['name'];
	}
	public function getByCityId($id)
	{
		$_DB = E_DBConnectionPool::getDbHandle();
		$sql = "select * from citys where id='$id'";
		$row = $_DB->fetch($sql);
		return $row['name'];
	}
	public function getByAreaId($id)
	{
		$_DB = E_DBConnectionPool::getDbHandle();
		$sql = "select * from areas where id='$id'";
		$row = $_DB->fetch($sql);
		return $row['name'];
	}
}
?>